package com.lenovo.smarttraffic.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.lenovo.smarttraffic.R;

public class Activity_8 extends AppCompatActivity {
    private ImageView fanhuiBtn;
    private TextView yijianBtn;
    private ProgressBar progrssbar1;
    private WebView webview1;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_8);
        init();
    }
    private void init(){
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        fanhuiBtn = (ImageView) findViewById(R.id.fanhui_btn);
        fanhuiBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        yijianBtn = (TextView) findViewById(R.id.yijian_btn);
        yijianBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Activity_8.this,Activity_8_2.class);
                startActivity(intent);
            }
        });
        progrssbar1 = (ProgressBar) findViewById(R.id.progrssbar1);
        webview1 = (WebView) findViewById(R.id.webview1);
        webview1.getSettings().setJavaScriptEnabled(true);
        webview1.loadUrl("file:///android_asset/user.html");
        webview1.setWebChromeClient(new WebChromeClient(){
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                if (newProgress==100){
                    progrssbar1.setVisibility(View.GONE);
                    progrssbar1.setProgress(newProgress);
                }else {
                    progrssbar1.setVisibility(View.VISIBLE);
                    progrssbar1.setProgress(newProgress);
                }
            }
        });
        webview1.setWebViewClient(new WebViewClient(){

        });
    }
}
